package servlets;

import hibernate.HibernateOperations;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * User: shprotik
 * Date: 18.04.12
 * Time: 19:09
 * To change this template use File | Settings | File Templates.
 */
public class DeleteServlet extends HttpServlet{
    public void init(ServletConfig config) throws ServletException {
        super.init(config);

    }
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {

           HibernateOperations obj=new HibernateOperations();
           obj.delete(Long.parseLong(req.getParameter("id")));
           String url ="/task4/servlet/SaveServlet";
           res.sendRedirect(res.encodeRedirectURL(url));

    }
}
